package com.czy.owner.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.czy.owner.R;
import com.czy.owner.db.SearchTable;

import java.util.List;

/**
 * Created by asus on 2017/5/15.
 */

public class GoodsSearchHistoryAdapter extends BaseRecyclerAdapter<SearchTable,GoodsSearchHistoryAdapter.GoodsSearchHistoryViewHolder> {
    public GoodsSearchHistoryAdapter(Context context, List<SearchTable> data) {
        super(context, data);
    }

    @Override
    public GoodsSearchHistoryViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new GoodsSearchHistoryViewHolder(layoutInflater.inflate(R.layout.item_goods_search_history,parent,false));
    }

    @Override
    public void onBindViewHolder(GoodsSearchHistoryViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        holder.bindData(data.get(position));
    }

    public class  GoodsSearchHistoryViewHolder extends BaseRecyclerAdapter.ViewHolder{
        private TextView tvGoodsSearchHistory;
        public GoodsSearchHistoryViewHolder(View itemView) {
            super(itemView);
            tvGoodsSearchHistory = (TextView)itemView.findViewById(R.id.tv_goods_search_history);
        }
        public void bindData(SearchTable searchTable){
            tvGoodsSearchHistory.setText(searchTable.getKeyWord());
        }
    }
}

